package com.blackitheima3.InnerDemo;

public class TestSwimming {
    public static void main(String[] args) {
        //创建实现类对象
        SwimmingImple si=new SwimmingImple();
        si.swim();
        //匿名内部类
        new Swimming(){

            @Override
            public void swim() {
                System.out.println("黑子,来狗刨!");
            }
        }.swim();

    }
    public static void goSwimming(Swimming swimming){
        swimming.swim();
    }
}
interface Swimming{
    public abstract void swim();
}
class SwimmingImple implements Swimming{

    @Override
    public void swim() {
        System.out.println("黑子,我们上课自学游泳来了");
    }
}
